home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Add-Ons / MPW / MPW re2c 1.1 / substr.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-09-08  |  907 b   |  51 lines  |  [TEXT/KAHL]

  1. #ifndef _substr_h
  2. #define _substr_h
  3.  
  4. // $Log: substr.h,v $
  5. //Revision 1.1  1994/04/08  15:27:59  peter
  6. //Initial revision
  7. //
  8.  
  9. #include <iostream.h>
  10. #include "basics.h"
  11.  
  12. class SubStr {
  13. public:
  14.     char        *str;
  15.     uint        len;
  16. public:
  17.     friend bool operator==(const SubStr, const SubStr);
  18.     inline SubStr(uchar*, uint);
  19.     inline SubStr(char*, uint);
  20.     inline SubStr(const SubStr&);
  21.     void out(ostream&) const;
  22. };
  23.  
  24. class Str: public SubStr {
  25. public:
  26.     Str(const SubStr&);
  27.     Str(Str&);
  28.     Str();
  29.     ~Str();
  30. };
  31.  
  32. inline ostream& operator<<(ostream& o, const SubStr s){
  33.     s.out(o);
  34.     return o;
  35. }
  36.  
  37. inline ostream& operator<<(ostream& o, const SubStr* s){
  38.     return o << *s;
  39. }
  40.  
  41. inline SubStr::SubStr(uchar *s, uint l)
  42.     : str((char*) s), len(l) { }
  43.  
  44. inline SubStr::SubStr(char *s, uint l)
  45.     : str(s), len(l) { }
  46.  
  47. inline SubStr::SubStr(const SubStr &s)
  48.     : str(s.str), len(s.len) { }
  49.  
  50. #endif
  51.